var gridUtils = function () {

    function getGridOpt(obj) {

        var columns = [];
        $.each(obj.columns, function (i, column) {
            var _column = {
                hidden: column.hidden === undefined ? false : column.hidden,// 是否隐藏该列
                label: column.label,// 显示列名称
                name: column.name,// 列字段属性名
                width: column.width === undefined ? "60" : column.width,// 列宽度
                isOrder: column.isOrder === undefined ? true : column.isOrder,// 是否排序
                isEdit: column.isEdit === undefined ? false : column.isEdit,
                isFmtJqueryObj: column.isFmtJqueryObj === undefined ? true : column.isFmtJqueryObj,
                formatter: column.formatter,//function (columnValue)格式化
            };
            if (column.editor) {//编辑
                _column.isEdit = true;
                _column.editor = {
                    maxLen: column.editor.maxLen,
                    inputType: column.editor.inputType === undefined ? "comSel" : column.editor.inputType,//text|comSel
                    comSelOpt: column.editor.comSelOpt,//通用下拉控件配置参数对象
                };
                if (column.editor.nameKey) {
                    _column.editor.nameKey = column.editor.nameKey
                }
                if (column.editor.valKey) {
                    _column.editor.valKey = column.editor.valKey
                }
                if (column.editor.inputID) {
                    _column.editor.inputID = column.editor.inputID
                }
            }
            columns.push(_column);
        });
        return {
            id: obj.id,//渲染对象ID 控件的唯一标识
            autoWidth: true,//是否自适应宽度,该属性设置时,列的width属性将失效,要让列的width属性生效请关闭该属性并设置colFixed属性为true
            autoHeight: false,
            isNotPage: true,
            className: "test",//表格样式类名
            checkbox: true,//是否显示选择按钮
            isMulitCheck: true,//是否支持多选
            loadMsg: "正在加载数据请稍等",//表格加载显示信息
            root: "data",//服务端返回的数据对象名
            url: obj.url === undefined ? "" : obj.url,
            columns: columns,
            param: obj.url === undefined ? {} : obj.url,
            // event: obj.event
            event: {
                onRowClick: function (rowData, rowObj) {
                },
                rowAdded: function (opt, gridObj, rowData) {//grid数据加载完成后执行
                }
            }
        };

    }

    return {
        getGridOpt: getGridOpt
    }
}();